<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>导入数据</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/buttons.css" />
<link rel="stylesheet" type="text/css" href="/jxcsxm/js/autocomplete/jquery.autocomplete.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-form.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/datagrid-detailview.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/util/jquery.cookie.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/YMLib.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/YWLib.js"></script>
<style type="text/css">.table{border: 1px solid #FFE7BA;} .table tr{border: 1px solid #FFE7BA;} .table tr td{border: 1px solid #FFE7BA;}</style>
<script type="text/javascript">

$(function(){
	$('#sbthcd').val($.cookie("unit2").length);
	$('#xmlx').val(getUrlParame("flag"));
	document.getElementById('submit').action=getUrlParame("url");
});

function zjdwtj(){
	if($('#fileupload').val()==''||$("#fileupload").val()==null){
		alert("上传文件不能为空");
		return;
		//document.getElementById('submit').action="/jxcsxm/tjbb/insertSbzjsq.do";
	} else {
		var filepath = $("#fileupload").val();
		var suffix = filepath.substr(filepath.lastIndexOf("."));
		//alert(suffix);
		if(".xls" != suffix && ".xlsx" != suffix ){
			alert("您选择的上传文件不是有效xls或者xlsx文件！");
			return ;
		}
		//document.getElementById('submit').action="/jxcsxm/zjdw/importZjdw.do";
	}
	
	
		$('#submit').ajaxSubmit({
			dataType:'json',
			success:function(msg){
				alert(msg.responseText);
				parent.queryXmlist();
				window.close();
			},
			error:function(msg){
				//alert("mag:"+msg);
				alert(msg.responseText);
				parent.queryXmlist();
				window.close();
			}
		});
	
	
}

</script>
</head>
<body>

<%--<form id="submit" action="/jxcsxm/tjbb/insertSbzjsq.do" method="post">
<form id="submit" action="/jxcsxm/tjbb/insertSbzjList.do" method="post"  enctype="multipart/form-data">--%>
<form id="submit"  method="post"  enctype="multipart/form-data">
<table class='table' style="width: 100%; background-color: #FFE7BA; font-size: 12px"
			border="0" cellpadding="3" cellspacing="1">
			
			<tr style="height: 35px;">
				<td style="background-color:#FFEFD5;color: #007DB3; font-weight: bold;" align="right">选择文件：</td>
				<td style="background-color: #ffffff; height: 20px;" align="left" colspan="3">
					<input type="file" name="fileupload" id="fileupload"  font-weight: bold;" align="right" />
					<input type="hidden" name="xmlx" id="xmlx"  font-weight: bold;" align="right" />
					<input type="hidden" name="sbthcd" id="sbthcd"  font-weight: bold;" align="right" />
				</td>
			</tr>
			<tr style="height: 35px;">
				<td style="background-color:#FFEFD5;color: #007DB3; font-weight: bold;" align="right">
			<a id='mybuttion1' style="margin-left: 5px;margin-bottom: 1px;" href="javascript:zjdwtj()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion1')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion1')"  class="button button-tiny button-rounded button-raised button-primary">保存</a>
		</td></tr>
		</table>
	</form>
</body>
</html>